package cn.jg.web.controller.sys.response;

import cn.jg.framework.common.bean.Converter;
import cn.jg.model.sys.User;
import lombok.Data;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.time.LocalDateTime;

/**
 * Created by admin on 2023/06/06.
 */
@Data
public class UserFoundResponse implements Converter<User, UserFoundResponse> {

    /**
     * id
     */
    private Integer id;

    /**
     * 用户名称
     */
    private String userName;

    /**
     * 电话号码
     */
    private String phone;

    /**
     * 邮箱
     */
    private String email;

    /**
     * 入住类型:0,个人1,企业2,机构
     */
    private Integer companyType;

    /**
     * 最后登录时间
     */
    private LocalDateTime lastLoginTime;

    @Override
    public UserFoundResponse convert(User user) {
        UserFoundResponse response = UserMapper.INSTANCE.convert(user);
        return response;
    }

    @Mapper
    interface UserMapper {
        UserMapper INSTANCE = Mappers.getMapper(UserMapper.class);

        UserFoundResponse convert(User user);
    }
}